<!-- 参考官方文档 -->
<template>
    <view class="">
        <button @click="navigateTo">跳转到页面生命周期</button>
        <button @click="navigateBack">跳转返回</button>
        <button @click="navigateToMiniProgram">跳转到其他小程序</button>
    </view>
</template>

<script lang="ts" setup>
    //获取当前的页面栈
    console.log(getCurrentPages());
    function navigateTo() {
        //跳转
        uni.navigateTo({
            //页面路径
            url: "/pages/other/page-lifecycle-detail/page-lifecycle-detail?name=张三&age=18"
        });
    };
    function navigateBack() {
        //跳转返回
        uni.navigateBack({
            //返回层数
            delta: 1
        });
    };
    function navigateToMiniProgram() {
        //跳转到其他小程序
        uni.navigateToMiniProgram({
            //小程序appId
            appId: "wxbd89d0ba67f6b6a4",
            //页面路径
            url: "/pages/index/index"
        });
    };
</script>

<style lang="scss" scoped>

</style>